package com.osce.common.constant;

import com.doudou.core.thread.ExecutorUtil;

import java.util.concurrent.ExecutorService;

/**
 * 缓存的key 常量
 *
 * @author ruoyi
 */
public class CacheConstants {
    /** 登录用户 redis key */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:",
    /** 验证码 redis key */
    CAPTCHA_CODE_KEY = "captcha_codes:",
    /** 参数管理 cache key */
    SYS_CONFIG_KEY = "sys_config:",
    /** 字典管理 cache key */
   SYS_DICT_KEY = "sys_dict:",
    /** 防重提交 redis key */
   REPEAT_SUBMIT_KEY = "repeat_submit:",
    /** 限流 redis key */
   RATE_LIMIT_KEY = "rate_limit:",
    /** 登录账户密码错误次数 redis key */
   PWD_ERR_CNT_KEY = "pwd_err_cnt:";

    public static final ExecutorService FACE_EXECUTOR_POOL = ExecutorUtil.systemThreadExecutor();
    public static final String CACHE_FACE_MAP_KEY = "face:faceFeature:map";

    /** 题目 map */
    public static final String EX_QUESTION_MAP_KEY = "ex:question:map",
            RATIO = "ratio",//按题库比例
            AVERAGE = "average",//平均选择
            OPTIONAL = "optional",//自选
            EX_QUESTION_ID_KEY = "question_id_";

    public static String questionKey(Long questionId) {
        return EX_QUESTION_ID_KEY + questionId;
    }

    public static final String SCORE_EXAM_CHECK_HTML = "<h2>日期：{}、时间[{}~{}]、房间：{}，与考试：{}，时间[{}-{}]有冲突</h2>",//检查房间冲突html模版
    SCORE_EXAM_STUDENT_IDS_KEY = "score_exam:exam:student:ids:",//【每场考试分配的学生，优化人脸识别用】
    SCORE_EXAM_WAITING_DATA_ADD_MAP_KEY = "score_exam:waiting:data:{}:{}",//【候考数据】插入时使用的格式化字符串，根据考试和时间添加
    SCORE_EXAM_WAITING_DATA_DEL_MAP_KEY = "score_exam:waiting:data:",//【候考数据】删除时使用的前缀，根据考试删除
    SCORE_EXAM_PLACE_CONNECT_MAP_KEY = "score_exam:place:connect:";//【考站内部连接对象数据】插入时使用的格式化字符串，根据考试和时间添加
}
